﻿using System.Collections.Generic;
using System.Linq;
using Complaint.Models.Dtos;
using Complaint.Repositories;

namespace Complaint.Models
{
    public class SettlementModel : BaseModel<SettlementRepository>,
        IModel<Settlement>
    {
        #region Implementation of IModel<Settlement>

        public IList<Settlement> Retrieve()
        {

            return Repository.FindAll().ToList();
        }

        public void Create(Settlement dto)
        {

            if (dto != null) Repository.Create(dto);
        }

        public void Update(Settlement dto)
        {

            if (dto != null) Repository.Update(dto);
        }

        public void Delete(Settlement dto)
        {

            if (dto != null) Repository.Delete(dto);
        }

        public IList<Settlement> FindByName(string name)
        {

            return Repository.FindByName(name).ToList();
        }

        public Settlement FindById(int id)
        {

            return Repository.FindById(id);
        }

        #endregion

        public IList<Settlement> FindByComplaint(int id)
        {

            return Repository.FindByComplaint(id).ToList();
        }
    }
}